<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="/asset/jQuery/jquery-3.3.1.js"></script>
</head>
<body>
<div align="center">
<input type="text" id="username" placeholder="请输入用户名"><br>
<input type="text" id="password" placeholder="请输入密码"><br>
<input type="button" id="submit" value="注册">
</div>
<script>
$(document).ready(function(){
	$("#submit").click(function(){
		alert("54515458");
		var username=$("#username").val();
		var password=$("#password").val();
		$.ajax({
			url:'/reg',
			type:'post',
			async:true,
			data:{
				"username":username,
				"password":password
			},
			dataType:'json',
			success:function(data){
				if (data.success) {
					alert(data.message);
					location.href="login.html";
				}else {
					alert(data.message);
				}
			}
		})
	})
})
</script>
</body>
</html>